import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path:'/',  //大首页
    component:()=>import('../views/index/index.vue'),
    children:[
      {path:'shop',component:()=>import('../views/index/components/shop.vue')},
      {path:'cate',component:()=>import('../views/index/components/cate.vue')},
      {path:'cart',component:()=>import('../views/index/components/cart.vue')},
      {path:'mine',component:()=>import('../views/index/components/my.vue')},
      {path:'',redirect:'/shop'},
    ]
  }, 
  //商品列表
  {path:'/goodslist',component:()=>import('../views/list/list.vue')},
  //商品详情
  {path:'/goodsdetail/:goodsid',component:()=>import('../views/detail/detail.vue')},
  //用户登录
  {path:'/login',component:()=>import('../views/login/login.vue')},
  //用户注册
  {path:'/zhuce',component:()=>import('../views/register/register.vue')},
  //重定向：
  {path:'*',redirect:'/shop'}
]

const router = new VueRouter({
  routes
})

export default router
